﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
using Gadgeteer.Interfaces.Sample.PhotoCamera.CameraApp;
using Gadgeteer.Interfaces.Fakes;

namespace CameraApp.Tests
{
    [TestFixture]
    public class BusyIndicationStackTest
    {
        [Test]
        public void ValidateTwoStacked()
        {
            var led = new FakeMultiColorLed();
            var stack = new BusyIndicationStack(led);

            Assert.That(stack.Busy, Is.False);
            using (var first = stack.Get())
            {
                Assert.That(stack.Busy);

                using (var second = stack.Get())
                {
                    Assert.That(stack.Busy);
                    Assert.That(led.IsOn);
                }

                Assert.That(stack.Busy);
            }
            Assert.That(stack.Busy, Is.False);
        }
    }
}
